import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_app/bean/BlogBean.dart';
import 'package:flutter_app/page/ToastWidget.dart';

class LeftContentItemWidget extends StatelessWidget {
  BlogBean bean;

  LeftContentItemWidget(this.bean);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      onTap: () {
        Toast.toast(context, msg: bean.title);
      },
      child: buildContainer(),
    );
  }

  Container buildContainer() {
    return Container(
      width: double.infinity,
      //底部外边距
      margin: EdgeInsets.only(bottom: 12),
      //圆角
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.all(Radius.circular(10)),
      ),
      //内边距
      padding: EdgeInsets.all(20),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        // https://swapps.com/wp-content/uploads/2018/07/trying-out-flutter.jpg
        children: [
          ClipRRect(
            borderRadius: BorderRadius.circular(8),
            child: Image.asset(
              bean.imgPath,
              height: 400,
              fit: BoxFit.fill,
            ),
          ),
          SizedBox(
            height: 16,
          ),
          Text(
            bean.title,
            style: TextStyle(
              fontWeight: FontWeight.w600,
              fontSize: 16,
              color: Colors.black,
            ),
          ),
        ],
      ),
    );
  }
}
